import { Component, OnInit,ViewChild } from '@angular/core';
import {ModalDirective} from 'ngx-bootstrap';
import {Router} from '@angular/router';

@Component({
  selector: 'app-activity-manage',
  templateUrl: 'activity-manage.component.html',
  styleUrls: ['activity-manage.component.scss'],
})
export class activityManageComponent implements OnInit {

  @ViewChild('addActivityModal') public addActivityModal: ModalDirective;
  @ViewChild('confirmReleaseModal') public confirmReleaseModal: ModalDirective;
  @ViewChild('confirmStopModal') public confirmStopModal: ModalDirective;
  @ViewChild('delActivityModal') public delActivityModal: ModalDirective;
  @ViewChild('delProcessingModal') public delProcessingModal: ModalDirective;

  constructor(private router: Router) {
  }

  addType: number;
  ngOnInit() {
  }
  closeModal(){
    this.addActivityModal.hide();
    this.confirmReleaseModal.hide();
    this.confirmStopModal.hide();
    this.delProcessingModal.hide();
    this.delActivityModal.hide();
  }
  publish(){
    this.confirmReleaseModal.show();
  }
  stopActivity(){
    this.confirmStopModal.show();
  }
  delActivity(type: number){
    if(!!type){
      this.delProcessingModal.show()
    }else{
      this.delActivityModal.show();
    }
  }
  //新建活动
  addActivity(){
    this.addActivityModal.show();
  }
  //新建营销活动下一步
  nextStep(){
    if(!this.addType){
      return
    }
    this.router.navigate(['/main/activity-manage/add/'+this.addType]);
  }
}
